package com.zb.huaweitest;

import java.util.Scanner;

public class HJ20 {
    public static void main(String[] args) {
//        Scanner s = new Scanner(System.in);
//        String in = "^Awsl7w222*hV\n" +
//                "0p^6#HJ5v4@3zxQv#~1q85\n" +
//                "$5^$q6\n" +
//                "s*z8F1O~7~3%83~y46~6&5w15)F46-7483\n" +
//                "z(9Zh+$ZT*8(9c9&P202*CFM\n" +
//                "pYr71#@nG5@)\n" +
//                "8#I682T090!32gth&Wl)O*!H-&-%$En^2*3S$-\n" +
//                "w3214(08$*o*7j$I-6!5$1b90974b25)p550#D*)@^SU%\n" +
//                "W(4+1Q2#*&*aX3+02ig8m\n" +
//                "W!8nDUP0l$m6!k1en8)j4-JQ+\n" +
//                "5o04ac-l#$-eM021$6*66n9b#o7d06~)^f4\n" +
//                "6~@\n" +
//                "Yw-09-Q78G**81O&J210\n" +
//                "))20Uq%0\n" +
//                "L83M!g!$~!7&u2B-#ovw~7LKRz5+!\n" +
//                "!3^@^%45*892nv&50~0S6e2y9U!&i~8iWu2K8z\n" +
//                "~32@M#\n" +
//                "3&!8-~6c1-0l#!ommNW%2dJ6U)0JmdR@586!7#+4+-e^)2$\n" +
//                "++^(348~8N^d$19@2GU3&(3$07i@tt1#)S-*6!(+!34u\n" +
//                "$y2*+@^7w8~4^0+EN7%1#n94Fpdb4&\n" +
//                "55\n" +
//                "a\n" +
//                "R!g9FpT78$F8WAq~!#(491#F67bf*23X6^48Q\n" +
//                "00W^20&+L$+B&tH!12^%))4@3F^*OVK(6l6#%27ja\n" +
//                "(-%&5Et6-2n&%#Tk38(iz&0A7qa8u9((\n" +
//                "&-4d3$)9&9nMA3@%J0@#~X8wi17kv1V*88%9X2$h+R3@#5v\n" +
//                "b225H04-!~33#\n" +
//                "31L$(!i2^8m$2^p\n" +
//                "p3L^04Pg5923!2$$9pE&009Kjm&1d5(\n" +
//                "r-^$t6@9O)ReC(8^7b9!T-g0+y+5!\n" +
//                "n6$++Us66h20!E61$%E%3gMw#-0!\n" +
//                "^-$ezL%-$30k2plAN9+i8544$B-($aS611#H*0\n" +
//                "*+5B459-u17&s9$6JRJ@%MD07-5^03^806SN44I@$(*y5-~$2(\n" +
//                "05ag\n" +
//                "-CUuJ5Pg39~Wby@^$093Y)kdQ8&Zg51*\n" +
//                ")-q4(@~l~)ATN\n" +
//                ")37^%%\n" +
//                "jC0$4T003#v6*@65&w87a6r3^!x(r%OA28540G33Nl!3\n" +
//                "&Lh3bvG@!2mGk%+3k57N8s\n" +
//                "$##467F61vI5JN204oB@hK!0\n" +
//                "35HI^k89&x4)+107~cJ-5d258Y*)4%mPHs^8\n" +
//                "07A4D8$X9C8pZ*4v690y#W5#@0$0-+B99Jfd\n" +
//                "ZH^7%0k3(n5460217!-41H%\n" +
//                "dSwg*6r$%6tQr(\n" +
//                "z5!hn%&1$67s*c\n" +
//                "-&~OBtk#$UCI1-q!Dc(nx43!W8Up!*4-6&12&ba$3~4-\n" +
//                "80-K!+@#y67854*7%GbB1(*~b2I^u9jCE5~999N0$%~\n" +
//                "#~5^R7G!&k(7P-%48@m\n" +
//                "-59V*R(j+~*\n" +
//                "7!(@0f#+C0$(7$00-A#A4+-KxH8M&^l-8-%9+MB+g4X+b%-*\n" +
//                "#Z@#!xu6x9\n" +
//                "A!(630sKb06$#bI12~!4!3%%Sa1H+2%(~8G-3A4#)\n" +
//                "@+##+*#g534+$+05$D@4~%Z5370\n" +
//                "F858@TG%&Y0@2$Ba0C&g\n" +
//                "6V1W49o~ow%S@W8@@\n" +
//                "z87\n" +
//                "47$Z^\n" +
//                "&+36grQ7%9+6g0D*925oBp\n" +
//                "+19%55@+2oW^i79R)&JGL8&64@836~%%H318l@5G1I)&&@54&1\n" +
//                "I@4-(85$-6!B@4+j)@\n" +
//                "CS6(5%x50v%#3D686&7@C!1!-kd-pf7r16";

//        String in = ")96794()@%i";
//        String[] passes = in.split("\n");

//        test(passes);

        System.out.println(('9' - '0'));
    }

    static void test(String[] inputs) {
        int index = 0;
        while(index < inputs.length) {
            String input = inputs[index];
            index ++;



            if(0 == input.length() || input.length() < 8) {
                System.out.println("NG");
                continue;
            }

            boolean numberFlag = false;
            boolean upperFlag = false;
            boolean lowerFlag = false;
            boolean simbolFlag = false;
            boolean typeFlag = false;
            int typeCount[] = new int[4];

            for(int i=0; i<input.length(); i++) {
                char c = input.charAt(i);
                if(!numberFlag) {
                    numberFlag = isNumber(c);
                    if(numberFlag) {
                        typeCount[0] = 1;
                        continue;
                    }
                }
                if(!upperFlag) {
                    upperFlag = isUpperCase(c);
                    if(upperFlag) {
                        typeCount[1] = 1;
                        continue;
                    }
                }
                if(!lowerFlag) {
                    lowerFlag = isLowerCase(c);
                    if(lowerFlag) {
                        typeCount[2] = 1;
                        continue;
                    }
                }
                if(!simbolFlag) {
                    simbolFlag = isUnknowSimbol(c);
                    if(simbolFlag) {
                        typeCount[3] = 1;
                        continue;
                    }
                }
                if((typeCount[0] + typeCount[1] + typeCount[2] + typeCount[3]) >= 3) {
                    typeFlag = true;
                    break;
                }
            }

            if(!typeFlag) {
                System.out.println("NG");
                continue;
            }

            if(containsRepet(input)) {
                System.out.println("NG");
                continue;
            }
            System.out.println("OK");
        }
    }

    static boolean isNumber(char c) {
        if(c >= '0' && c <= 9)
            return true;
        return false;
    }

    static boolean isUpperCase(char c) {
        if(c >= 'A' && c <= 'Z')
            return true;
        return false;
    }

    static boolean isLowerCase(char c) {
        if(c >= 'a' && c <= 'z')
            return true;
        return false;
    }

    static boolean isUnknowSimbol(char c) {
        if(!isNumber(c) && !isLowerCase(c) && !isUpperCase(c))
            return true;
        return false;
    }

    static boolean containsRepet(String input) {
        int left = 0;
        int right = input.length() / 2 + 1;
        int subLength = 3;
        while(subLength <= (input.length() / 2 + 1)) {
            for(int i=0; i<(input.length() - subLength); i++) {
                String subString = input.substring(i, i+subLength);
                if(input.replace(subString, "").length() < (input.length() - subString.length())) {
                    return true;
                }
            }

            subLength++;
        }
//         while(left < right || (right - left) > 2) {
//             String subString = input.substring(left, right);
//             if(input.replace(subString, "").length() < (input.length() - subString.length())) {
//                 return true;
//             }
//         }


        return false;
    }


}
